<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>帅帅平江扎鸟</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="full-screen" content="true"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="360-fullscreen" content="true"/>
    <script src="./source/js/server.js?v=4.8"></script>
    <script src="server.js?v=4.8"></script>
    <style>
        html, body {
            -ms-touch-action: none;
            background: #FFFFFF;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
    </style>
    <script src="polyfill.min.js"></script>
    <script src="cookie.js"></script>
    <script src="core.min.js"></script>

    <script egret="lib" src="libsrc/bin/weixinapi/weixinapi.js" src-release="libsrc/bin/weixinapi/weixinapi.min.js"></script>
    <script>
        //隐藏微信菜单
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            // 通过下面这个API隐藏右上角按钮
            // alert('hideOptionMenu!!!');
            WeixinJSBridge.call('hideOptionMenu');
        })
        //显示微信菜单
        function showMenu(){
            WeixinJSBridge.call('showOptionMenu');
        }

    //流量统计
        /*var _hmt = _hmt || [];
        (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?8b3f54474964aab606e5c07d77075185";
        var s = document.getElementsByTagName("script")[0]; 
        s.parentNode.insertBefore(hm, s);
        })();*/
    </script>
    <!--这个标签为通过egret提供的第三方库的方式生成的 javascript 文件。删除 modules_files 标签后，库文件加载列表将不会变化，请谨慎操作！-->
    <!--modules_files_start-->
	<script egret="lib" src="libs/modules/egret/egret.js" src-release="libs/modules/egret/egret.min.js"></script>
	<script egret="lib" src="libs/modules/egret/egret.web.js" src-release="libs/modules/egret/egret.web.min.js"></script>
	<script egret="lib" src="libs/modules/game/game.js" src-release="libs/modules/game/game.min.js"></script>
	<script egret="lib" src="libs/modules/res/res.js" src-release="libs/modules/res/res.min.js"></script>
	<script egret="lib" src="libs/modules/eui/eui.js" src-release="libs/modules/eui/eui.min.js"></script>
	<script egret="lib" src="libs/modules/tween/tween.js" src-release="libs/modules/tween/tween.min.js"></script>
	<script egret="lib" src="libs/modules/socket/socket.js" src-release="libs/modules/socket/socket.min.js"></script>
	<script egret="lib" src="libsrc/bin/weixinapi/weixinapi.js" src-release="libsrc/bin/weixinapi/weixinapi.min.js"></script>
	<!--modules_files_end-->

    <!--这个标签为不通过egret提供的第三方库的方式使用的 javascript 文件，请将这些文件放在libs下，但不要放在modules下面。-->
    <!--other_libs_files_start-->
    <script egret="lib" src="polyfill/promise.js" src-release="polyfill/promise.min.js"></script>
    <script src="ftclient.js"></script>
    <script src="nad-0.1.js"></script>
    <script src="./source/js/nad.js"></script>
    <script src="./source/js/pako.min.js"></script>
    <script src="fetch.min.js"></script>    
    <!--other_libs_files_end-->

    <!--这个标签会被替换为项目中所有的 javascript 文件。删除 game_files 标签后，项目文件加载列表将不会变化，请谨慎操作！-->
    <!--game_files_start-->
	<script egret="game" src="bin-debug/Game/gameRoom/module/shareClewInfo.js"></script>
	<script egret="game" src="bin-debug/ArraySort.js"></script>
	<script egret="game" src="bin-debug/Data/Events.js"></script>
	<script egret="game" src="bin-debug/Data/GameData.js"></script>
	<script egret="game" src="bin-debug/Data/RelplayTest.js"></script>
	<script egret="game" src="bin-debug/Data/StageData.js"></script>
	<script egret="game" src="bin-debug/Data/StringData.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/centerOutPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/movePoint.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/outPoker1.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/outPoker2.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/outPoker3.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/outPoker4.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/outPokerPack.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/centerPoker/point.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/chathShowObjWnd.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/chatImageobjWnd.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/chatRoomWnd.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/chatTextobjWnd.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/playRadio.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/playRemind.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/chat/TextChatWnd.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/addRoom.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/ChiChoose.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/model3Ren.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/operationBtn.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/startGameBtn.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/Tile.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/DIYBtn/YaoShaiZi.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/end/lucky.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/end/LuckyYao.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/end/roundEndGame.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/end/roundEndGameObj.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/end/winningCard.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/gamePlayImage.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/location/locationBg1.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/location/locationBg2.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/location/locationBg3.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/location/locationObj.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/location/locationwnd.js"></script>
	<script egret="game" src="bin-debug/AssetAdapter.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/module/TimerCountDown.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/module/windowGroup.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/module/winEffect.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/playImage2.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/endHandPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/gamePlayHandPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/handPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/handPokerPlay.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/myHandPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/playHandPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/playHandPokerVideo.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/TanpaiMy.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/TanpaiOther.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/winLeft.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/winPENG.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/winRight.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/poker/winTop.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/room.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/roomInfo.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/SurplusPokerNum.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/TingPoker.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/window/clewInfo.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/window/playImageVote.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/window/setUp.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/window/videoPlay.js"></script>
	<script egret="game" src="bin-debug/Game/gameRoom/window/vote.js"></script>
	<script egret="game" src="bin-debug/Game/GameStage.js"></script>
	<script egret="game" src="bin-debug/Game/loadClew.js"></script>
	<script egret="game" src="bin-debug/JSSDK.js"></script>
	<script egret="game" src="bin-debug/loadImage.js"></script>
	<script egret="game" src="bin-debug/LoadingUI.js"></script>
	<script egret="game" src="bin-debug/Main.js"></script>
	<script egret="game" src="bin-debug/Message.js"></script>
	<script egret="game" src="bin-debug/MyLibrary.js"></script>
	<script egret="game" src="bin-debug/MyUtils.js"></script>
	<script egret="game" src="bin-debug/PostLink.js"></script>
	<script egret="game" src="bin-debug/soundPlay.js"></script>
	<script egret="game" src="bin-debug/StringOmit.js"></script>
	<script egret="game" src="bin-debug/ThemeAdapter.js"></script>
	<!--game_files_end-->
</head>
<body>
   <div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
         data-entry-class="Main"
         data-orientation="landscapeFlipped"
         data-scale-mode="exactFit"
         data-frame-rate="30"
         data-content-width="1166"
         data-content-height="720"
         data-show-paint-rect="false"
         data-multi-fingered="2"
         data-show-fps="false" data-show-log="false"
         data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
    </div>    
    <script type="text/javascript">

   var _urlString; 
   //初始化服务器地址
	function InitServerUrl(str){
		//alert("js服务器地址:"+str);
		_urlString = str;
		onload();
	}
    var sock;
	function onload(){
        //window.setClose();
		sock = window.ftclient.newSock(String(window._urlString), {
			onopen: function(){	
                window.sockOpen();
                var str = '{"chat":{"chatType":2},"chatMsg":"test","secure":false,"token":"'+GameData.token+'","time":0,"type":100000,"version":"v1.0"}';
                window.send(str);
			},
			onclose: function(){
				window.sockClose();
				//console.log("WebSocket Closed　关闭\n");
			},
			onmessage: function(message){
				//console.log("返回:"+JSON.stringify(message));
				egret.MainContext.instance.stage.getChildByName("_main").sockMessage(message);
				switch(message.type) {
						case 100000:
						//ta.value = '就拿到结果了呀';
						break;
						default:
						//ta.value = ta.value + message.msg + '\n';
				}	
			}
		}); 
	};

var sockObj;
//关闭连接
function setClose(){
    try{        
        if(sock){
            sock.close(1000,"0");
        }        
    }catch(e){
	}   
}
//发送内容接口
function send(jsonmsg) {
	//alert("发送");
	try { var msg = JSON.parse(jsonmsg);}catch(e){}
	if(typeof msg !='object') {
		alert('error 发送的消息格式错误');
		return;
	}
	try{
		this.sockObj = sock.getReadyState();
	}catch (e){

	}

	if(this.sockObj&&this.sockObj == sock.OPEN) {
		sock.send(msg);
	} else {
		//alert('websocket已经关闭');
		sockClose();
	}
	this.sockObj = null;
}
//websocket已经关闭
function sockClose(){
	egret.MainContext.instance.stage.getChildByName("_main").sockClose();
}
//sockOpen成功打开
function sockOpen(){
    egret.MainContext.instance.stage.getChildByName("_main").sockOpen();
}
</script>
<div id="gameID"> </div>
    <script>    
     // 手机浏览器解决方案,处理宽和高,如果是生成APP,请另一个原生JS文件,可以参照这种方式.  
     var aspectRatio = {portrait: "竖屏", landscape: "横屏"};//横竖屏的处理  
     var resolution = {width: 1166, height: 720};//默认宽高 
    //处理屏幕大小改变
    //implement for screen size change
    var resizeTimer = null;
     var doResize = function(){
              if(open){
              doResizeEvent(null)
              }
             //context.stage.changeSize();
              resizeTimer = null;
     }
     function doResizeEvent(aspect) {  
        var wid, hei, radio;//宽,高,像素比 
        var w,h; 
        //获取窗口宽度  
        if (window && window.innerWidth)  
            wid = window.innerWidth;  
        else if ((document.body) && (document.body.clientWidth))  
            wid = document.body.clientWidth;  
        //获取窗口高度  
        if (window && window.innerHeight)  
            hei = window.innerHeight;  
        else if ((document.body) && (document.body.clientHeight))  
            hei = document.body.clientHeight;  
        //通过深入Document内部对body进行检测，获取窗口大小  
        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {  
            wid = document.documentElement.clientWidth;
            hei = document.documentElement.clientHeight;
        }  
        //设备像素比,这里如果获取不到就自动默认为1,如果有特殊需求可以自行修改  
        radio = window.devicePixelRatio || 1;  
        //处理横竖屏  
        if (aspect == null) {  
            aspect = aspectRatio.portrait;//横竖屏自己给吧  
        }  
        resolution = (aspect == aspectRatio.portrait) ? {width: wid, height: hei} : {width: hei, height: wid};  
      //  console.log(aspect+"屏幕宽:"+ resolution.width+ "|"+ "屏幕高:"+ resolution.height+ "|"+ "设备像素比:"+ radio);  
        //下面赋值给宽高适配手机浏览器  
          if(resolution.width>resolution.height){
           w=resolution.width;
           h=resolution.height;
          }else{
           w=resolution.height
           h=resolution.width;
          }
     var u = navigator.userAgent;
     var rotate=true;
     if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
     selectedHandler & selectedHandler(thisRef,w, h,radio,"android");
     
     }else if(u.indexOf('iPad') > -1){
        rotate=false;
        selectedHandler & selectedHandler(thisRef,w, h,radio,"android");
     }else if(u.indexOf('iPhone') > -1) {//苹果手机
          selectedHandler & selectedHandler(thisRef,w, h,radio,"ios");
    // alert("苹果手机");
     } else if(u.indexOf('Windows Phone') > -1) {//winphone手机
     //alert("winphone手机");
     selectedHandler & selectedHandler(thisRef,w, h,radio,"ios");
     }else{
           rotate=false;
           w=resolution.width;
           h=resolution.height;
          selectedHandler & selectedHandler(thisRef,w, h,radio,"pc");
     //alert("浏览器");
     }
     egret.MainContext.instance.stage.getChildByName("_main").transverse(resolution.width>resolution.height,rotate);
      
    };
    window.onresize = function () {
        if (resizeTimer == null) {
            resizeTimer = setTimeout(doResize, 300);
        }
    };
    //设置舞台大小
                var selectedHandler;
                var thisRef;
                var open=false;
                function onStageSize(selectedFunc, thisValue) {
                   selectedHandler = selectedFunc;
                   thisRef = thisValue;
                   open=true;
                   doResizeEvent(null); 
                }
         // 
         function getJSUrl(){
             var url = window.location.href;
             return url;
         }
         
        //get 请求回放数据        
        function getItems(_url,_token){
            sendGet(_url,_token).then(function(res) {return res.json()}).then(function (data) {
                if(data){                    
                    egret.MainContext.instance.stage.getChildByName("_main").huifang_ok(data);
                }else{
                    egret.MainContext.instance.stage.getChildByName("_main").huifang_error();
                }
            })
        }
        function sendGet(_url,_token){
                var url = _url;
                var opt = {
                    method: 'GET',
                    headers: {
                    Authorization: _token,
                    'Content-type': 'application/json'
                    }
                }
                return fetch(url,opt)
        }
        
        /**
         * {
         * "renderMode":, //引擎渲染模式，"canvas" 或者 "webgl"
         * "audioType": "" //使用的音频类型，0:默认，1:qq audio，2:web audio，3:audio
         * "antialias": //WebGL模式下是否开启抗锯齿，true:开启，false:关闭，默认为false
         * }
         **/
        egret.runEgret({renderMode:"canvas", audioType:0});
    </script>
</body>
</html>
